Accusoft.ImagXpress13.ActiveX
Reduce a JPEG Image

Use the JPEGReduceFile and JPEGReduceData methods to reduce JPEGs in memory or on disk without first decompressing to a DIB, thereby saving processor time and system resources.  

Only 8-bpp grayscale and 24-bpp color JPEGs are supported.

File size reduction is accomplished by requantizing the source JPEG.

Compression ratios and perceived image quality will vary depending on the source JPEG. Generally, higher JPEG compression comes at the cost of visual quality. For this reason, an optional qualityFactor argument is provided to balance compression versus visual quality trade-offs.

Larger qualityFactor values correspond to larger luminance and chrominance values, which may degrade visual quality. For example, consider the 2592x3872, 24-bit color sequential JPEG in Figure 1 that is reduced using various qualityFactor values:

The JPEGReduceFileEx and JPEGReduceDataEx methods also accept a transformMode argument to save reduced JPEGs as either Sequential or Progressive JPEG.

A Progressive JPEG consists of multiple image scans in progressively higher detail. JPEG viewers that support Progressive JPEGs can display the lower quality images while the remainder of the file is read into memory, which may improve the user experience for viewing large images.

Saving to Progressive JPEG may result in slightly larger files when compared to JPEGs reduced and saved as Sequential JPEG. For example, consider again the 2592x3872, 24-bit color sequential JPEG in Figure 1 that is reduced using various qualityFactor values and converted to Progressive JPEG:

 

Figure 1: An example 24-bit color sequential JPEG. Dimensions 2592 x 3872. Original size is 2746 KB.


Figure 2: An example 24-bit color sequential JPEG, reduced from 2746 KB to 420 KB with qualityFactor 10.


Figure 3: An example 24-bit color sequential JPEG, reduced from 2746 KB to 246 KB with qualityFactor 22.


Figure 4: An example 24-bit color sequential JPEG, reduced from 2746 KB to 196 KB with qualityFactor 32.

Reduce a JPEG on Disk

To reduce JPEGs on disk, just specify the path to the source JPEG and the path to save the re-compressed JPEG using the JPEGReduceFile method. Specify the qualityFactor to affect compression and image quality.

To reduce JPEGs on disk and re-save as either Progressive or Sequential, use the JPEGReduceFileEx method. Specify the path to the source JPEG, the path to save the re-compressed JPEG, the qualityFactor to affect compression and image quality, and the transformMode to affect the JPEG format produced.

Reduce a JPEG in Memory

To reduce JPEGs expressed in memory, first read the source JPEG data into the variant and then re-compress the JPEG data using the JPEGReduceData method. Specify the qualityFactor to affect compression and image quality.

To reduce JPEGs expressed in memory and re-save as either Progressive or Sequential, first read the source JPEG data into the variant and then use the JPEGReduceDataEx method. Specify the qualityFactor to affect compression and image quality, and the transformMode to affect the JPEG format produced.

 

 


©2015. Accusoft Corporation. All Rights Reserved.

Send Feedback